﻿using System;
using System.Collections.Generic;
using System.Data;
using Excel = Microsoft.Office.Interop.Excel;
using System.Drawing;

namespace AP_GestArm
{
    class ExcellLivres
    {
        public static void Camaras(DataTable dt)
        {

            #region Ve camaras existentes na Tabela e junta a array

            string[] Camaras = new string[0];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string Camara = "Câmara" + dt.Rows[i]["Camara"].ToString();
                if (!((IList<string>)Camaras).Contains(Camara))
                {
                    Array.Resize(ref Camaras, i + 1);
                    Camaras[i] = Camara;
                }
            }

            #endregion

            #region Mete visiveis as camaras constantes da Array Camaras e Insere Títulos

            int numSheets = ExcelClass.xlWorkBook.Sheets.Count;            
            for (int sheetNum = 2; sheetNum < numSheets+1; sheetNum++)
            {
                ExcelClass.xlWorkSheet = (Excel.Worksheet)ExcelClass.xlWorkBook.Worksheets.get_Item(sheetNum);
                ExcelClass.xlWorkSheet.Visible = Excel.XlSheetVisibility.xlSheetHidden;
                if (((IList<string>)Camaras).Contains(ExcelClass.xlWorkSheet.Name))
                { ExcelClass.ShowSheet(ExcelClass.xlWorkSheet); }
            }
            
            #endregion
        }
        #region tamanhos das células

        public static void TamanhoCerto(string Celula)
        {
            Excel.Range range;
            range = ExcelClass.xlWorkSheet.get_Range(Celula, Type.Missing );
            range.Interior.Color = System.Drawing.ColorTranslator.ToOle(Color.Green);
        }
        public static void TamanhoMaior(string Celula)
        {
            Excel.Range range;
            range = ExcelClass.xlWorkSheet.get_Range(Celula, Type.Missing );
            range.Interior.Color = System.Drawing.ColorTranslator.ToOle(Color.Yellow);
        }

        #endregion
    }
}
